using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter20
{
	/// <summary>
	/// Example02: Cooling a Hot Ingot
	/// A 0.05 kg ingot of metal is heated to 200.0 C and then
	/// dropped into a beaker containing 0.4 kg of water initially
	/// at 20.0 C. If the final equilibrium temperature of the mixed
	/// system is 22.4 C, find the spectific heat of the metal.
	/// c = 453 J/kg/C
	/// </summary>
	public class Example02
	{
		public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass watermass  = new L.Mass();
			watermass.kg = 0.4;
			L.Temperature ti = new L.Temperature();
			ti.C = 20.0;
			L.Temperature tf = new L.Temperature();
			tf.C = 22.4;
			L.SpecificHeat waterc = new L.SpecificHeat();
			waterc.JPERkgPERCelsius = L.Constant.SpecificHeatOfWater;
			L.Heat Q = new L.Heat(watermass,waterc,ti,tf);

			ti.C = 200.0;
			tf.C = 22.4;
			L.Mass m  = new L.Mass();
			m.kg = 0.05;
			L.SpecificHeat c = new L.SpecificHeat(Q,m,ti,tf);
				
			result+=Convert.ToString(c.JPERkgPERCelsius);
		}
	}
}
